package com.mcy.springbatch.config;

import com.mcy.springbatch.job.*;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.support.ApplicationContextFactory;
import org.springframework.batch.core.configuration.support.GenericApplicationContextFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * batch配置类，让spring启用batch，初始化batch相关核心组件
 */
@Configuration
@EnableBatchProcessing(modular = true)
public class BatchConfiguration {

    @Bean
    public ApplicationContextFactory loadCFlowJobConfig(){
        return new GenericApplicationContextFactory(CFlowJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadDeciderJobConfig(){
        return new GenericApplicationContextFactory(DeciderJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadESpliteJobConfig(){
        return new GenericApplicationContextFactory(ESpliteJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadFJobAndStepLinstenerJobConfig(){
        return new GenericApplicationContextFactory(FJobAndStepLinstenerJobConfig.class);
    }

    @Bean
    public ApplicationContextFactory loadGJobParamJobConfig(){
        return new GenericApplicationContextFactory(GJobParamJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadHReadWriteDataWithFileJobConfig(){
        return new GenericApplicationContextFactory(HReadWriteDataWithFileJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadIMultiReadWriteDataWithFileJobConfig(){
        return new GenericApplicationContextFactory(IMultiReadWriteDataWithFileJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadJReadWriteDataWithDbJobConfig(){
        return new GenericApplicationContextFactory(JReadWriteDataWithDbJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadKFileReadWriteDataDListenerJobConfig(){
        return new GenericApplicationContextFactory(KFileReadWriteDataDListenerJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadLRestartReaderJobCofig(){
        return new GenericApplicationContextFactory(LRestartReaderJobCofig.class);
    }
    @Bean
    public ApplicationContextFactory loadMErrorJobConfig(){
        return new GenericApplicationContextFactory(MErrorJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadNRetryJobJobConfig(){
        return new GenericApplicationContextFactory(NRetryJobJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadOSkipJobJobConfig(){
        return new GenericApplicationContextFactory(OSkipJobJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadPMultiProcessorJobConfig(){
        return new GenericApplicationContextFactory(PMultiProcessorJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadQMultiThreadJobConfig(){
        return new GenericApplicationContextFactory(QMultiThreadJobConfig.class);
    }
    @Bean
    public ApplicationContextFactory loadRPartitionerJobConfig(){
        return new GenericApplicationContextFactory(RPartitionerJobConfig.class);
    }
}
